package com.ytk.action;

import java.io.UnsupportedEncodingException;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.interceptor.annotations.Before;
import com.ytk.util.Constants;

public class WebmasterActionSupport extends ActionSupport implements SessionAware, ServletRequestAware, ServletResponseAware  {

	/**
	 * 序列化數字
	 */
	private static final long serialVersionUID = 133330528L;

	protected Map<String, Object> session;

	protected HttpServletRequest request;
	
	protected HttpServletResponse response;
	
	@Override
	public void setSession(Map<String, Object> arg0) {
		// TODO Auto-generated method stub
		session=arg0;
	}

	@Override
	public void setServletRequest(HttpServletRequest arg0) {
		try {
			arg0.setCharacterEncoding(Constants.CHARACTER_ENCODING_UTF8);
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		request=arg0;
	}

	@Override
	public void setServletResponse(HttpServletResponse arg0) {
		arg0.setCharacterEncoding(Constants.CHARACTER_ENCODING_UTF8);
		response=arg0;
	}
	@Before
	public void setChar(){
		
	}
}
